<%-- 
  - Author: Asna Khader
  - Date: 02-Jan-2012
  - Copyright Notice: TRAKHEES
  - Description: show.jsp
 --%>
<%@ include file="/WEB-INF/view/include.jsp"%>
<form:form modelAttribute="CompanyInformationInfo" name="TKSAdminCompanyHomeFrm"  id="TKSAdminCompanyHomeFrm"  method="POST" enctype="multipart/form-data" class="t_form">

      <div class="t_company-profile-container">
        <h1 class="t_company-name"><spring:message code="label.company_profile" /></h1> <h2 class="t_company-info"><spring:message code="label.company_information" /></h2>
    	<br/>
       
     		    <table border="0">
	     		    <tr>
	     		    	<td>
	     		    		 <div><form:label path="selectedCompany"><spring:message code="label.tks.selcomp" /><span class="required-field"><spring:message code="label.field.required" /></span></form:label></div>
	     		    	</td>
	     		    	<td>
	     		    		<div><form:select  id="selectedCompany" path="selectedCompany" items="${companyList}" itemLabel="companyName" itemValue="tksId" /></div>
	     		    	</td>
	     		    	<td>
	     		    		 <button type="button" class="button_small" onclick="if(validate()){submitForm();};"><spring:message code="btn.tks.show"  /></button>
	     		    	</td>
	     		    </tr>
        		</table>
				
	<c:choose>
      <c:when	test='${CompanyInformationInfo.showCompanyInfo == "SUCCESS"}'>
			
          <div class="t_heading-colum">
            <ul>
                <li><spring:message code="label.company_name" /></li>
                <li><spring:message code="label.licence_no" /></li>
                <li><spring:message code="label.medical_type" /></li>
                <li><spring:message code="label.allowed_nos" /></li>
            </ul>
          </div>

          <div class="t_detail-colum">
            <ul>
            	<c:choose>
	            	<c:when	test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
						<li>${CompanyInformationInfo.companyNameAr}</li>
					</c:when>
					<c:otherwise>
						<li>${CompanyInformationInfo.companyName}</li>
					</c:otherwise>
				</c:choose>
                <li>${CompanyInformationInfo.companyLicenseNo }</li>
                <c:choose>
      			<c:when	test='${medicalMap[CompanyInformationInfo.medicalType] == "0"}'>
                	<li>${medicalMap[CompanyInformationInfo.medicalType]}</li>
                </c:when>
                <c:otherwise>
                	<li>NA</li>
                </c:otherwise>
                </c:choose>
                <li><fmt:formatNumber value="${CompanyInformationInfo.allowedVisaNos}"  pattern="${numberPattern}" /></li>
            </ul>
          </div>
          <%-- <img class="t_view-profile-btn" src="resources/images/view-profile-btn.png" alt="" />--%> </div>
      <div class="t_tfinancial-cont">
        <div class="t_financial-top"><spring:message code="label.financial_info" /></div>
        <ul>

         <li>
            <div class="t_fin-black-txt"><spring:message code="label.bg_req" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bgRequired}"  pattern="${numberPattern}" /></div>
          </li>

          <li>
            <div class="t_fin-black-txt"><spring:message code="label.bg_paid" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bgPaid}"  pattern="${numberPattern}" /></div>
          </li>
          <li>
            <div class="t_fin-black-txt"><spring:message code="label.bg_bal" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bankGuaranteeBalance}"  pattern="${numberPattern}" /></div>
          </li>
        
          <li>
            <div class="t_fin-black-txt"><spring:message code="label.prepaid_actual_account" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.prepaidAccBalance}"  pattern="${numberPattern}" /></div>
          </li>
          <li>
            <div class="t_fin-black-txt"><spring:message code="label.prepaid_reserve_account" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.reservedAccBalance}"  pattern="${numberPattern}" /></div>
          </li>
        </ul>
      </div>
      </c:when>
      <c:otherwise></c:otherwise>
      </c:choose>
    </form:form>

    <!--Middle Right Close-->
<script type="text/javascript">

   $(".topnav").accordion({
		accordion:false,
		speed: 500,
		closedSign: '<img src=\'resources/images/common/close.jpg\' />',
		openedSign: '<img src=\'resources/images/common/open.jpg\' />'
	});
   
   $().ready(function(){
		$("#TKSAdminCompanyHomeFrm").validate({

			onfocusout:false,
			onkeyup:false,
			onclick: false,			
			rules : {
				selectedCompany : "required"
			},
			showErrors : function(errorMap, errorList) {
				
				var errors = '<ul>';
				var label;				
				if (errorList.length) {
					$.each(errorMap, function(name, value) {
						label = $("label[for='" + name + "']").html();
						label = value + '[' + label + ']';
						errors = errors + '<li>' + label + '</li>';
						

					});
					errors = errors + '</ul>';
					jAlert('error', errors, '<spring:message code="label.errormessage" />');
					return false;
				}
			}		
		});//
	   
   });
	
function validate(){
	return ($("#TKSAdminCompanyHomeFrm").validate().element("#selectedCompany"));
}
function submitForm(){
	 $('#TKSAdminCompanyHomeFrm').submit();
}


</script>